/**
 * 组合继承：原型链继承 + 经典继承 
 */
// 先提供父构造函数
function Animal(type, age, weight, length) {
    this.type = type;
    this.age = age;
    this.weight = weight;
    this.length = length;
}
// 提供父构造函数原型对象方法和属性 
Animal.prototype = {
    constructor: Animal,
    atype: '父构造函数原型属性--atype',
    sayType: function () {
        console.log(this.type, '父构造函数原型对象方法')
    }
}
// 子构造函数继承父构造函数 经典继承 
function Dog(type, age, weight, length, name, color) {
    // 1.经典继承 借用构造函数继承 
    Animal.call(this, type, age, weight, length);
    // this.type = type;
    // this.age = age;
    this.name = name;
    this.color = color;
}
// 原型链继承 让子构造函数实例d1可以去继承父构造函数Animal属性和方法 
// 将子构造函数原型对象指向父构造函数实例 
Dog.prototype = new Animal();
Dog.prototype.constructor = Dog;
Dog.prototype.sayType = function () {
    console.log('我是Dog原型方法');
}
var d1 = new Dog('狗', 10, '20kg', '40cm', '可乐', '白色');
// console.log(d1);
console.log(d1.type);
console.log(d1.atype);
d1.sayType();